import pandas as pd

###################url/csv/xls读写，筛选与选择输出###################
#url读取数据
url='https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv'
data=pd.read_csv(url)
print(data)

group=data.groupby('day')
#print(group.first())
'''
#写入数据到路径csv格式
data.to_csv('F:\pycharmProjects\data analysis\study_328\data1.csv',encoding='utf-8',index=False)
#index为行编号
#excel读取
data1=pd.read_excel('F:\pycharmProjects\data analysis\study_328\data.xls')
print(data1)


#首尾两行，默认为5行
print (data.head(2))   #默认5行
print(data.tail(2))

#index为行，column为列
print(data.columns)
print(data.index)

print(data.iloc[10:12,0:3])



#筛选，并选择性输出
aa=data[['day','time']][(data.sex=='Female') & (data.tip>5)]
print(aa)
#排序
print(data.sort_values(by='tip'))
'''